<template>
  <!-- <t-space direction="vertical"> -->
  <!-- 按钮操作区域
    <t-radio-group v-model="size" variant="default-filled">
      <t-radio-button value="small">小尺寸</t-radio-button>
      <t-radio-button value="medium">中尺寸</t-radio-button>
      <t-radio-button value="large">大尺寸</t-radio-button>
    </t-radio-group> -->

  <!-- 当数据为空需要占位时，会显示 cellEmptyContent -->

  <div class="baseList">
    <div class="newBox">
      <button class="bt wt-120" @click="handleBulid()">新增护理项目</button>
    </div>
    <div class="tableBoxs">
      <t-table
        row-key="index"
        :data="data"
        :columns="COLUMNS"
        :bordered="bordered"
        :hover="hover"
        :size="size"
        :show-header="showHeader"
        cell-empty-content="-"
        resizable
        lazy-load
      >
        <!-- 图片预览及展示 -->
        <template #image="{ row }">
          <div class="tdesign-demo-image-viewer__base">
            <t-image-viewer :images="[row.image]">
              <template #trigger="{ open }">
                <div class="tdesign-demo-image-viewer__ui-image">
                  <img
                    alt="test"
                    :src="row.image"
                    class="tdesign-demo-image-viewer__ui-image--img"
                  />
                  <div
                    class="tdesign-demo-image-viewer__ui-image--hover"
                    @click="open"
                  >
                    <span> <BrowseIcon size="1.4em" /> 预览 </span>
                  </div>
                </div>
              </template>
            </t-image-viewer>
          </div>
        </template>
        <!-- 价格拼接 -->
        <template #price="{ row }">
          {{ row.price.toFixed(2) }}
        </template>

        <!-- 按钮处理 -->
        <template #op="{ row }">
          <div class="operateCon">
            <a class="btn-dl">删除</a>
            <a class="font-bt" @click="handleEdit(row.id)">编辑</a>
            <a class="delete">禁用</a>
          </div>
        </template>
      </t-table>
      <!-- 分页 -->
      <t-pagination
        v-if="total > 4"
        v-model="pagination.pageNum"
        v-model:pageSize="pagination.pageSize"
        :total="total"
        @change="onPageChange"
      />
    </div>
  </div>
  <!-- </t-space> -->
</template>

<script setup lang="jsx">
import { COLUMNS } from '../constants'
const pros = defineProps({
  data: {
    type: Object,
    default: []
  },
  // bordered: Boolean,
  // hover: Boolean,
  // size: Number,
  total: Number,
  pagination: {
    type: Object,
    default: {}
  }
})
//接受事件
const emits = defineEmits(['onPageChange', 'handleBulid', 'handleEdit'])
const handleEdit = (id) => {
  emits('handleEdit', id)
}
//执行事件
const onPageChange = (pageInfo) => {
  emits('onPageChange', pageInfo)
}
const handleBulid = () => {
  emits('handleBulid')
}
</script>
